package com.chenchao.javaoop;

/**
 * @encoding : UTF-8
 * @Time : 2020/12/5 10:42
 * @Author : Chen Chao
 * @File : javaSE.com.chenchao.javaoop.Test01.java
 * @Software : IntelliJ IDEA
 * @since : 1.8
 */
public class Test01 {
    public static void main(String[] args) {
        /*实现类不会导致接口的加载*/
        RealSon realSon = new RealSon();
        realSon.speak();
        System.out.println(realSon.age);
    }
}
interface  IFather{
    /**如果被初始化，构造代码块会被加载*/
    Thread t=new Thread(){
        {System.out.println("IFather被加载了");}
    };
    void speak();
}
class RealSon  implements IFather{
    int age=10;
    @Override
    public void speak() {
        System.out.println("realSon Speak");
    }
}
